/* Header file of State and Event classes */

#ifndef ITF_ST_HEADER
#define ITF_ST_HEADER


#include <QObject>
#include <QGraphicsScene>
#include <QGraphicsEllipseItem>

#include <graphviz/gvc.h>

#include "prefix_tree.h"

#include "mex.h"

class State : public QObject, public QGraphicsEllipseItem
{
    Q_OBJECT

public:
    State(unsigned int stateid, Agraph_t *gvc_graph);
    
    void draw(QGraphicsScene *scene);
    Agnode_t * getAgnode();
    double getCoordX();
    double getCoordY();
    double getWidth();
    double getHeight();

signals:
    void displayStateECDF(double *, int);
    
private:
    unsigned int id;
    Agraph_t *gvc_graph;
    Agnode_t *gvc_node;
    
    void mousePressEvent(QGraphicsSceneMouseEvent * event);
     
};


class Event : public QObject, public QGraphicsPathItem
{
    Q_OBJECT
            
public:
    Event(State* s0, State* s1, unsigned int eventid, Agraph_t *gvc_graph, ntrieNode* node);
    void draw(QGraphicsScene *scene);
    void drawArrow(QGraphicsScene *scene);
    void mousePressEvent(QGraphicsSceneMouseEvent * event);
    
signals:
    void displayECDF(double *, unsigned int, unsigned int, unsigned int);
    
private:
    unsigned int id;
    ntrieNode* ntrie_n;
    Agraph_t *gvc_graph;
    Agedge_t *gvc_edge;
    QPainterPath shape;
    
};


#endif
